package com.ys.erp.stage_mall_service.controller;

import com.ys.erp.framework.annotation.CheckEmpLogin;
import com.ys.erp.framework.annotation.ResponseResult;
import com.ys.erp.framework.annotation.StageLoginEmp;
import com.ys.erp.framework.bean.dto.StageEmpDTO;
import com.ys.erp.stage_mall_service.bean.condition.HomeActivityCondition;
import com.ys.erp.stage_mall_service.bean.vo.HomeActivityInfoVO;
import com.ys.erp.stage_mall_service.bean.vo.HomeActivityVO;
import com.ys.erp.stage_mall_service.service.HomeMallActivityService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author minamiyama
 * @date 2025/5/19 11:33
 */
@RestController
@RequiredArgsConstructor
@RequestMapping("/manage/mall/home/activity/")
@Tag(name = "营销活动相关请求对象", description = "营销活动相关请求对象")
@ResponseResult
public class HomeActivityController {
    private final HomeMallActivityService homeMallActivityService;


    @PostMapping("addOrUpdateHomeActivity")
    @Operation(summary = "添加或更新营销活动")
    @CheckEmpLogin
    public void addOrUpdateHomeActivity(@RequestBody HomeActivityCondition.AddOrUpdateCon con, @StageLoginEmp StageEmpDTO emp) {
        homeMallActivityService.addOrUpdateHomeActivity(con, emp);
    }

    @GetMapping("delHomeActivity")
    @Operation(summary = "删除营销活动")
    @CheckEmpLogin
    public void delHomeActivity(@RequestParam("homeActivityId") Long homeActivityId, @StageLoginEmp StageEmpDTO emp) {
        homeMallActivityService.delHomeActivity(homeActivityId, emp);
    }

    @GetMapping("updateHomeActivityStatus")
    @Operation(summary = "更新营销活动状态")
    @CheckEmpLogin
    public void updateHomeActivityStatus(@RequestParam("homeActivityId") Long homeActivityId, @StageLoginEmp StageEmpDTO emp) {
        homeMallActivityService.updateHomeActivityStatus(homeActivityId, emp);
    }

    @GetMapping("getHomeActivityList")
    @Operation(summary = "获取营销活动列表")
    @CheckEmpLogin
    public List<HomeActivityVO> getHomeActivityList(@StageLoginEmp StageEmpDTO emp) {
        return homeMallActivityService.getHomeActivityList(emp);
    }


    @GetMapping("getHomeActivityInfo")
    @Operation(summary = "获取营销活动详情")
    @CheckEmpLogin()
    public HomeActivityInfoVO getHomeActivityInfo(@RequestParam("homeActivityId") Long homeActivityId,@StageLoginEmp StageEmpDTO empDTO) {
        return homeMallActivityService.getHomeActivityInfo(homeActivityId);
    }


}
